# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=gamja
pkgver=1.0.0_beta6
_pkgver=v${pkgver/_beta/-beta.}
pkgrel=0
pkgdesc="Simple IRC web client"
url="https://sr.ht/~emersion/gamja/"
license="AGPL-3.0"
arch="noarch !riscv64" # blocked by nodejs
makedepends="npm"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~emersion/gamja/archive/$_pkgver.tar.gz"
builddir="$srcdir/$pkgname-$_pkgver"
options="!check" # no test suite

build() {
	npm install --production
}

package() { 
	local webroot="$pkgdir"/usr/share/webapps/gamja

	install -d "$webroot" "$pkgdir"/usr/share/doc/gamja
	cp -r "$builddir"/* "$webroot"
	mv "$webroot"/README.md "$pkgdir"/usr/share/doc/gamja

	# default empty config
	echo "{}" | install -Dm644 /dev/stdin "$pkgdir"/etc/gamja/config.json
	ln -s /etc/gamja/config.json "$pkgdir"/usr/share/webapps/gamja/config.json
}

sha512sums="
87d864a8837a1a949bd20ae6a6630ca6659efec99b190182e4c953a67486dab17273f9f0f3ad1b72bfad97d8f45a15839b0fdaba465d1be41da030ffb9a4ccf2  gamja-1.0.0_beta6.tar.gz
"
